using System;
using Sinacor.Infra.UI.Common;
using Sinacor.Infra.UI.Security.Services;
using System.Collections.Generic;
using Sinacor.Infra.Common;

namespace Sinacor.UI.Bovespa.ManutencaoOrdens.Communication.Translator.DataContractToModel
{
    /// <summary>
    /// Traduz um contrato de dados em um modelo
    /// </summary>
    public class Calendario
    {
		public Calendario(){}

		/// <summary>
        /// ToCalendario
		/// </summary>
		/// <param name="from"></param>
		/// <returns></returns>
        public Model.Calendario ToCalendario(Communication.Bovespa.ManutencaoOrdens.Calendario.CalendarioResponse from)
        {
            Model.Calendario retorno = new Sinacor.UI.Bovespa.ManutencaoOrdens.Model.Calendario();

            if (from == null)
                return null;

            retorno.DataPregao = from.DataPregao;

            return retorno;
		}

		/// <summary>
        /// ToCalendario - LIST
		/// </summary>
		/// <param name="from"></param>
		/// <returns></returns>
        public ModelCollection<Model.Calendario> ToCalendario(List<Communication.Bovespa.ManutencaoOrdens.Calendario.CalendarioResponse> from)
        {
            ModelCollection<Model.Calendario> lista = new ModelCollection<Sinacor.UI.Bovespa.ManutencaoOrdens.Model.Calendario>();
            Model.Calendario item = null;

            if (from == null)
                return null;

            foreach (Communication.Bovespa.ManutencaoOrdens.Calendario.CalendarioResponse inLista in from)
            {
                item = this.ToCalendario(inLista);
                lista.Add(item);
            }

            return lista;
		}
	}
}